﻿using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;

namespace BUS
{
    public class tbDoanhNghiepBus
    {
        public static void Insert_DoanhNghiep(tbDoanhNghiep doanhnghiep)
        {
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            doanhnghiepDAL.Insert(doanhnghiep);
        }
        public static void Update_DoanhNghiep(tbDoanhNghiep doanhnghiep)
        {
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            doanhnghiepDAL.Update(doanhnghiep);
        }
        public static void Delete_DoanhNghiep(int Id)
        {
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            doanhnghiepDAL.Delete(Id);
        }
        public static tbDoanhNghiep.tbDoanhNghiepCollection Get(string Where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {

            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            return (doanhnghiepDAL.Get(Where, pageindex, pagesize, orderby, orderdirection, out total));
        }
        public static tbDoanhNghiep.tbDoanhNghiepCollection GetAll()
        {
            int total = 0;
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            return doanhnghiepDAL.Get("Where 1=1", 0, 0, tbDoanhNghiep.tbDoanhNghiepColumns.IDDoanhNghiep.ToString(), "ASC", out total);
        }
        public static tbDoanhNghiep GetByID(int iD)
        {
            int total = 0;
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            tbDoanhNghiep.tbDoanhNghiepCollection doanhnghiepcollection = doanhnghiepDAL.Get("where " + tbDoanhNghiep.tbDoanhNghiepColumns.IDDoanhNghiep.ToString() + "=" + iD.ToString(), 0, 0, tbDoanhNghiep.tbDoanhNghiepColumns.IDDoanhNghiep.ToString(), "ASC", out total);
            if (doanhnghiepcollection.Count > 0)
                return doanhnghiepcollection[0];
            return null;
        }

    } 
}
